<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 试寻找字符串当中，连续重复重复次数最多的字符。
        let str = 'aaaaabbbbcccccccccccccccddddeeee';

        function dealWithStr(s) {
            var x = 0;
            var maxRepeatChar = null;
            var maxRepeatCount = 0;
            for (let i = 0; i < (s.length + 1); i++) {
                if (s[x] != s[i]) {
                    console.log(`${s[x]} 的长度：${i - x}`);
                    if (maxRepeatCount < (i - x)) {
                        maxRepeatCount = i - x;
                        maxRepeatChar = s[x]
                    }
                    x = i;
                }
            }
            console.log("t:", maxRepeatChar);
        }

        dealWithStr(str)
    </script>
</body>

</html>